var MojoFlix = new Object();
MojoFlix.rev                = 3;
MojoFlix.SearchDesc         = 'Search on MojoFlix';
MojoFlix.Name               = 'MojoFlix';
MojoFlix.Search             = function (keyword, page){
  var result = new Object();
  result.bypage            = 20;
  result.start             = (page-1)*result.bypage+1;
  c = GetContents('http://mojoflix.com/Search/'+escape(keyword)+'/'+page);
  switch (keyword) {
    case '#best':
    c = GetContents('http://mojoflix.com/Videos/TopToday/'+page);
    break;
    case '#news':
    c = GetContents('http://mojoflix.com/Videos/New/'+page);
    break;
    case '#views':
    c = GetContents('http://mojoflix.com/Videos/Top/'+page);
    break;
  }
  result.total             = -1;
  result.VideoInfo = new Array();
  if (page == 1){
    video = new Object();
    video.attr               = 1;
    video.Title              = 'GoTube info';
    video.Description        = 'You can search #best, #news or #views for find the best, the news \n or the most viewed videos on this site.';
    video.Tags               = '#best #news #views';
    result.VideoInfo.push(video);
  }
  while (p = c.indexOf('<td class="newVidBg2" valign="top">',p)+1){
    video = new Object();
    video.attr               = 3;
    video.page               = 'http://www.mojoflix.com'+ext('href="');
    video.Id                 = ext('src="http://media.mojoflix.com/','.jpg')
    video.ThumbnailURL       = 'http://media.mojoflix.com/'+video.Id+'.jpg';
    video.Title              = ext(", '","'");
    video.Description        = ext(", '","'");    
    video.SaveFilename       = video.Title+'.flv';
    video.Id                 = video.Id.replace(/thumb_/, '').replace(/_[0-9]{2}$/, '').split('/');
	video.URL                = 'http://media.mojoflix.com/flash8/'+video.Id[0]+'/'+video.Id[1]+'/flash_'+video.Id[2]+'.flv';
    result.VideoInfo.push(video);
  }
  result.end               = result.start-1+result.VideoInfo.length;
  return result;
}
SiteList.push(MojoFlix);
